<script type="text/javascript" src="<?php echo URLPRE;?>static/public/Lib/validate/messages_cn.js"></script>
<form class="formvalidate" action="<?php echo $save_pay_account_url;?>" method="post">
    <div class="wrap">
        <div class="table_full">
            <div class="table_full">
                <?php if(!empty($list)):?>
                    <table width="100%">
                        <col width="50" />
                        <col width="100" />
                        <col width="150" />
                        <col width="100" />
                        <col width="100" />
                        <col />
                        <tbody>
                        <tr>
                            <td>编号</td>
                            <td>金额</td>
                            <td>日期</td>
                            <td>操作人</td>
                            <td>状态</td>
                            <td>备注</td>
                        </tr>
                        <?php foreach($list as $key=>$val):?>
                            <tr>
                                <td><?php echo $key+1?></td>
                                <td><?php echo $val['pay_account']?></td>
                                <td><?php echo $val['add_time']?></td>
                                <td><?php echo $val['action_user']?></td>
                                <td><?php echo '已审核';?></td>
                                <td><?php echo $val['note']?></td>
                            </tr>
                        <?php endforeach;?>
                        </tbody>
                    </table>
                <?php endif;?>
                <table width="100%">
                    <col class="th" />
                    <col/>
                    <tbody>

                        <tr>
                            <th>订单总金额</th>
                            <td>
                                <input type="hidden" id="order_account" value="<?php echo $order_info['order_account'];?>" />
                                <?php echo price_format($order_info['order_account']);?></td>
                            <th>订单已支付金额</th>
                            <td>
                                <input type="hidden" id="paid_account" value="<?php echo $order_info['paid_account'];?>" />
                                <?php echo price_format($order_info['paid_account']);?></td>
                        </tr>
                        <tr>
                            <th>支付金额</th>
                            <td>￥<input type="text" name="pay_account" id="pay_account" value="<?php echo ($order_info['order_account']-$order_info['paid_account']);?>" class="input rounded" size="5" validate="{required:true,number:true,}" /></td>
                            <th>余款</th>
                            <td><?php echo price_format($order_info['order_account']-$order_info['paid_account'])?></td>
                        </tr>

                    <tr>
                        <th>备注</th>
                        <td colspan="3"><textarea name="note" style="width: 98%;" validate="{required:true,}"></textarea></td>
                    </tr>
                    </tbody>
                </table>
                <input type="hidden" name="return_url" value="<?php echo $_SERVER['HTTP_REFERER']?>"/>
                <div class="btn_wrap_pd">
                </div>
            </div>
        </div>
    </div>
    <div class="aui_buttons">
        <input name="order_id" type="hidden" value="<?php echo $order_info['order_id'];?>" />
        <button class="aui_state_highlight" type="submit">确定</button>
    </div>
    <script type="text/javascript">
        $(function(){
            //支付金额判断
            $('#pay_account').blur(function(){
                var $val = parseFloat($(this).val()).toFixed(2);
                var $surplus = parseFloat($('#order_account').val()-$('#paid_account').val()-$('#paid_supplier').val()).toFixed(2);
                if($val-$surplus>0){
                    $.dialog.alert('支付金额已超过需支付金额');
                    $(this).val($surplus);
                    return false;
                }
            })
        })
    </script>
</form>